<template>
    <div class="container">
        <uni-easyinput
            type="textarea"
            autoHeight
            v-model="formParams.content"
            :primaryColor="global.THEME_COLOR"
            placeholder="请输入内容"></uni-easyinput>

        <view class="btn-wrap">
            <text class="btn" @click="handlerSave">提 交</text>
        </view>
    </div>
</template>

<script setup lang="ts">
import { reqAddFeedbackAPI } from '@/apis/feedback'
import { inject, reactive } from 'vue'

// 全局属性
const global: any = inject('global')

const formParams = reactive({
    content: ''
})

const handlerSave = async () => {
    // 请求新增意见反馈接口
    await reqAddFeedbackAPI(formParams)
    uni.showToast({
        title: '提交成功',
        duration: 1000
    })

    setTimeout(() => {
        uni.switchTab({ url: '/pages/me/index' })
    }, 1000)
}
</script>
  
<style scoped lang="scss">
.container {
    padding: 10rpx;
    .btn-wrap {
        padding-top: 20rpx;
        display: flex;
        justify-content: center;
        .btn {
            display: block;
            width: 700rpx;
            height: 70rpx;
            line-height: 70rpx;
            border-radius: 5rpx;
            color: #fff;
            text-align: center;
            background-color: $uni-color-primary;
        }
    }
}
</style>